package com.itheima.controller;

import com.itheima.pojo.ClassOption;
import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 1 统计员工职位人数
     * @return
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        log.info("查询报表统计员工职位人数");
     JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }


    /**
     * 2 统计员工性别人数
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("查询报表统计员工性别人数");
     List<Map<String,Object>> genderList= reportService.getEmpGenderData();
        return Result.success(genderList);
    }

    /**
     * 3 统计班级人数
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        log.info("查询报表统计班级人数");
      ClassOption  classOption = reportService.getStudentCountData();
        return Result.success(classOption);
    }
    /**
     * 4 学生学历统计
     */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData(){
        log.info("查询报表统计学院学历人数");
        List<Map<String,Object>> degreeList= reportService.getStudentDegreeData();
        return Result.success(degreeList);
    }

}
